package 曾世昌12_8.zuoye19;

import java.lang.reflect.Constructor;

public class test {
    /**
     * 方法功能:新建实例对象
     * <p>
     * //     * @param className 包名+类名
     * //     * @param args      构造函数的参数
     *
     * @return 新建的实例对象
     */
    public static void main(String[] args) throws Exception {
        Object[] arr = {12, 23, 34};
        new test().newInstance( "曾世昌", arr );

    }

    public Object newInstance(String className, Object[] args) throws Exception {
        Class<?> aClass = Class.forName( "rc.mxdx3_zhoumozuoye.zuoye19.Person" );
        Constructor<?> declaredConstructor = aClass.getDeclaredConstructor();
        declaredConstructor.setAccessible( true );
        Object o = declaredConstructor.newInstance();
        return o;
    }
}
